﻿using DataModels.Enums.WorkOrder;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using static DataModels.Enums.GeneralEnum;

namespace DataModels.Entities.WorkOrder
{
    [SugarTable("workorder_rapid")]
    public class WorkOrderRapid
    {
        [SugarColumn(IsPrimaryKey = true)]
        public Guid UUID { get; set; } = Guid.NewGuid();


        /// <summary>
        /// 工单编号
        /// </summary>
        public string OrderNo { get; set; } = Utils.MicrosecondTimeStamp.GenerateUniqueId();

        /// <summary>
        /// 房屋ID
        /// </summary>
        public Guid? HouseUUID { get; set; }

        /// <summary>
        /// 电话号码
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 工单标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 工单描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 工单类型ID
        /// </summary>
        public int TypeId { get; set; }

        /// <summary>
        /// 期望上门时间
        /// </summary>
        public string DoorTime { get; set; }

        /// <summary>
        /// 工单类型
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// 优先级
        /// </summary>
        public WorkOrderPriority Priority { get; set; } = WorkOrderPriority.Medium;

        /// <summary>
        /// 工单状态
        /// </summary>
        public WorkOrderRapidStatus Status { get; set; } = WorkOrderRapidStatus.New;

        /// <summary>
        /// 实际解决时间
        /// </summary>
        public DateTime? ActualResolveTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 关闭时间
        /// </summary>
        public DateTime? CloseTime { get; set; }



        /// <summary>
        /// 申请人ID
        /// </summary>
        public Guid RequesterId { get; set; }

        /// <summary>
        /// 处理人ID
        /// </summary>
        public Guid? ProcessorId { get; set; }

        /// <summary>
        /// 所属项目ID（可选）
        /// </summary>
        public Guid? ProjectId { get; set; }

        /// <summary>
        /// 客户满意度评分（1-5分）
        /// </summary>
        [Range(1, 5, ErrorMessage = "满意度评分必须在1-5分之间")]
        public int? SatisfactionScore { get; set; }

        /// <summary>
        /// 满意度评价
        /// </summary>
        public string SatisfactionComment { get; set; }

        /// <summary>
        /// 状态变更原因
        /// </summary>
        public string ReasonForChange { get; set; }

        /// <summary>
        /// 物料连表 8-21 废弃
        /// </summary>
        public string MaterialUUID { get; set; }


        /// <summary>
        /// 物料 文字
        /// </summary>
        public string material { get; set; }

        /// <summary>
        /// 处理费用
        /// </summary>
        public decimal expenseAmount { get; set; }

        /// <summary>
        /// 是否加急
        /// </summary>
        public Status Urgent { get; set; } = Enums.GeneralEnum.Status.Disable;
        /// <summary>
        /// 通知次数
        /// </summary>
        public int Inform { get; set; }
    }
}
